#include <libpub.h>

extern "C" {
void wls_keypad_init();
void msleep(unsigned int ms);
char wls_keypad_getkey();
int printk(const char *fmt, ...);
}

//This is FOR T8 Real Test
#define KEY_EXIT    0x42   //define OK Key to exit
int _Do_Test_Keypad(char *param)
{
    int key = 0;
    static int init_ok = 0;
    TOUT(1, 1, printf("\nTest Keypad :\n"));

    if(init_ok == 0) {
        wls_keypad_init();
        printk("\nKeypad Init OK: ");
        init_ok = 1;
    }
    //0xff: No Key Pressed
    while(key != KEY_EXIT) {
        key = wls_keypad_getkey();
        if(key != 0xff){
            printk("\nKey = 0x%x\n", key);
        }
    }
    printk("\nKEY_EXIT = 0x%x\n", key);
    printk("\nKeypad Test Over.\n");

    return 0;
}

